package com.ttj.controller.purchaser;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ttj.domain.oracle.SysconfBranch;
import com.ttj.service.BranchService;
import com.ttj.vo.BaseRes;

@Controller
@RequestMapping("purchaser/branch")
public class BranchController {

	private static Logger logger = LoggerFactory.getLogger(BranchController.class);
	
	@Resource
	private BranchService bService;
	
	@RequestMapping(value="/district",method=RequestMethod.GET)
	public @ResponseBody BaseRes<List<SysconfBranch>> getDistrict(String username){
		logger.debug(username);
		return bService.getDistrict(username);
	}
	
	@RequestMapping(value="/area",method=RequestMethod.GET)
	public @ResponseBody BaseRes<List<SysconfBranch>> getArea(String username,String district){
		logger.debug(username,district);
		return bService.getArea(username,district);
	}
	
	@RequestMapping(value="/street",method=RequestMethod.GET)
	public @ResponseBody BaseRes<List<SysconfBranch>> getStreet(String username,String area){
		logger.debug(username,area);
		return bService.getStreet(username,area);
	}
	
	@RequestMapping(value="/community",method=RequestMethod.GET)
	public @ResponseBody BaseRes<List<SysconfBranch>> getCommunity(String username,String street){
		logger.debug(username,street);
		return bService.getCommunity(username,street);
	}
}
